#ifndef FORMDEVLOG_H
#define FORMDEVLOG_H

#include <QWidget>
#include <QTableWidget>
#include <QVBoxLayout>
#include <QPushButton>
#include <QHeaderView>
#include <QScrollBar>
#include <QObject>
#include <QString>
#include <QList>
#include <QDateTime>

#include "common/common_data.h"
#include "g_config.h"
#include <QDebug>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>


namespace Ui {
class FormDevLOG;
}

class FormDevLOG : public QWidget
{
    Q_OBJECT

public:
    explicit FormDevLOG(QWidget *parent = nullptr);
    ~FormDevLOG();

    void addRowToTable(const LOG_INFO_T& log);
    bool insertLogInfo(const LOG_INFO_T& log_info);//插入数据

signals:
    void backRequested();

protected:
    void closeEvent(QCloseEvent *event) override;

public slots:
    void add_log_slot(QString sys_time, QString sys_mode, QString message);

private slots:
    void on_pushButton_clicked();

private:
    Ui::FormDevLOG *ui;

    QSqlDatabase alarm_info_db;
    bool createConnection();//创建数据库
    bool deleteLogInfo();//删除数据
    void getAllLogInfo();//查看数据库中的所有数据

    bool sort_flag = true;
};

#endif // FORMDEVLOG_H
